﻿<Window x:Class="SBattle.ConnectWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:aero="clr-namespace:Common.AeroGlass;assembly=Common"
        aero:GlassEffect.IsEnabled="True" 
        MouseLeftButtonDown="Window_MouseLeftButtonDown"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="SBattle - Connect to server" Height="221" Width="371">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="5"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Content="Player name:" VerticalAlignment="Center" />
        <TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="4" Text="{Binding PlayerName}" VerticalAlignment="Center" />

        <Label Grid.Row="1" Grid.ColumnSpan="5" Content="Found servers:" />

        <ListView Grid.Row="2" Grid.ColumnSpan="5" MouseDoubleClick="lvwServers_MouseDoubleClick"
                  ItemsSource="{Binding Servers}" SelectedItem="{Binding SelectedServer}" >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Name" Width="150" DisplayMemberBinding="{Binding Name}" />
                    <GridViewColumn Header="Address" Width="100" DisplayMemberBinding="{Binding Address}" />
                    <GridViewColumn Header="Ping" Width="90" DisplayMemberBinding="{Binding Ping}" />
                </GridView>
            </ListView.View>
        </ListView>

        <Button Grid.Row="4" Grid.Column="0" Content="Refresh"
                VerticalAlignment="Center" Click="btnRefresh_Click"/>

        <Label Grid.Row="4" Grid.Column="1" Content="Host: " VerticalAlignment="Center" />

        <TextBox Grid.Row="4" Grid.Column="2" Text="{Binding HostAddress}" VerticalAlignment="Center" />

        <Button Grid.Row="4" Grid.Column="4" Content="Connect" 
                VerticalAlignment="Center" Click="btnConnect_Click" />
    </Grid>
</Window>
